version 17.0
clear all
cap log close
log using prep_sample.log, replace

global RESULTS ../output
global TEMP ../temp
cap mkdir ../temp/estimate_w_xs
cap mkdir ../output/estimate_w_xs
cap mkdir ../output/estimate_w_xs/figures 

graph set window fontface default
graph set ps fontface default
graph set window fontfacemono "Consolas"
graph set ps fontfacemono "Consolas"
set scheme s1color


program main
	change_bin_numbers, size(25)
	cap log close
end

program change_bin_numbers 
	syntax, size(int)
	cap mkdir ../temp/estimate_w_xs
	if `size' == 25 {
		use ../external_links/real/model_sample, clear
		replace bin_number = bin_number_25
		save ../temp/estimate_w_xs/model_sample, replace
	} 
	else if `size' == 100 {
		drop bin_number 
		replace bin_number = ceil(bin_number_50 / 2)
		sum bin_number, d 
		assert r(min) == 1 & r(max) == 10
		save ../temp/estimate_w_xs/model_sample, replace
	}
	else {
		di "not a valid bin size"
	}
end 

* Execute
main

